package com.blacktry.mapper;

import com.blacktry.entity.model.AdminRole;
import com.blacktry.entity.model.Role;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.blacktry.entity.model.vueVO.Option;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author blackTry
 * @since 2021-06-25
 */
public interface RoleMapper extends BaseMapper<Role> {
    List<Role> getRoles(Integer id);

    @Select("select admin_role.*,role.name_zh from role LEFT JOIN admin_role on role.id = admin_role.role_id where admin_role.admin_id = #{id}")
    List<AdminRole> rolesById(Integer id);

    @Select("select name_zh from role")
    String[] getRolesStringArr();

    @Select("select role.id as value ,role.name_zh as label from role")
    List<Option> selectAllRoleOptions();
}
